package com.example.myapp.utils

/**
 * @author weng
 * @date 2022/7/28 9:43
 * @describe
 */
object StringUtils {

    //    字符串转成double，如果转换异常返回0
    fun StringToDouble(str: String): Double {
        var temp = 0.0
        temp = try {
            str.toDouble()
        } catch (e: NumberFormatException) {
            return 0.0
        }
        return temp
    }
}